import IPython
import time
import pari
import __main__
import __builtin__
from pari import *

def input_prompt(self, cont):
    if cont :
        return "... "
    else :
        return time.strftime('\033[33m(%H:%M) gp > \033[0m')
        
def output_prompt(self):
    name = '_'+str(len(IPython.ipapi.get().user_ns["_ih"])-1)
    return '\033[35m'+name+' =\033[0m '

IPython.ipapi.get().set_hook("generate_prompt", input_prompt)
IPython.ipapi.get().set_hook("generate_output_prompt", output_prompt)

def var(s):
    setattr(__main__, s, pari.var(s))

# some settings
var('x')
real_prec(28)
ser_prec(16)
div_behavior(1)
p0=cast(0)
p1=cast(1)
p=cast

print 'This is PARI-Python.'